package com.example.xxcjgl.data.api

import com.example.xxcjgl.data.models.ApiResponse
import com.example.xxcjgl.data.models.LoginRequest
import com.example.xxcjgl.data.models.Score
import com.example.xxcjgl.data.models.Student
import com.example.xxcjgl.data.models.User
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

// ApiService.kt
interface ApiService {

    @POST("login.php")
    suspend fun login(@Body request: LoginRequest): ApiResponse<User>

    @GET("getStudents.php")
    suspend fun getStudents(@Query("keyword") keyword: String): ApiResponse<List<Student>>

    @GET("getFirstUnencryptedStudent.php")
    suspend fun getFirstUnencryptedStudent(): ApiResponse<Student>

    @POST("addStudent.php")
    suspend fun addStudent(@Body student: Student): ApiResponse<Boolean>

    @POST("addScore.php")
    suspend fun addScore(@Body score: Score): ApiResponse<Boolean>

    @GET("verifyEncryptionKey.php")
    suspend fun verifyEncryptionKey(
        @Query("studentId") studentId: Int,
        @Query("key") key: String
    ): ApiResponse<Boolean>
}
